History log of /u-boot/arch/arm/mach-stm32mp/cmd_stm32key.c
Revision Date Author Comments
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# e8df6eeb 30-Apr-2024 Tom Rini <trini@konsulko.com>

arm: stm32/stm32mp: Remove <common.h> and add needed includes

Remove <common.h> from all mach-stm32 and mach-stm32mp files and when
needed add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# e8df6eeb 30-Apr-2024 Tom Rini <trini@konsulko.com>

arm: stm32/stm32mp: Remove <common.h> and add needed includes

Remove <common.h> from all mach-stm32 and mach-stm32mp files and when
needed add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# e8df6eeb 30-Apr-2024 Tom Rini <trini@konsulko.com>

arm: stm32/stm32mp: Remove <common.h> and add needed includes

Remove <common.h> from all mach-stm32 and mach-stm32mp files and when
needed add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e8df6eeb 30-Apr-2024 Tom Rini <trini@konsulko.com>

arm: stm32/stm32mp: Remove <common.h> and add needed includes

Remove <common.h> from all mach-stm32 and mach-stm32mp files and when
needed add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e8df6eeb 30-Apr-2024 Tom Rini <trini@konsulko.com>

arm: stm32/stm32mp: Remove <common.h> and add needed includes

Remove <common.h> from all mach-stm32 and mach-stm32mp files and when
needed add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e8df6eeb 30-Apr-2024 Tom Rini <trini@konsulko.com>

arm: stm32/stm32mp: Remove <common.h> and add needed includes

Remove <common.h> from all mach-stm32 and mach-stm32mp files and when
needed add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e8df6eeb 30-Apr-2024 Tom Rini <trini@konsulko.com>

arm: stm32/stm32mp: Remove <common.h> and add needed includes

Remove <common.h> from all mach-stm32 and mach-stm32mp files and when
needed add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 9f1dc110 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP15x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 49de864a 15-Jan-2024 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: Rename STM32MP13x

CONFIG options must not use lower-case letter. Convert this and related
ones to upper case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 33a909a4 06-Jan-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# e83cef87 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: adapt the command stm32key for STM32MP13x

Change the mask of OTP0 used to close the device on STM32MP
- STM32MP15x: bit 6 of OPT0
- STM32MP13x: 0b111111 = 0x3F for OTP_SECURED closed device

And support the 2 keys for STM32MP13x
- PKHTH : Hash of the 8 ECC Public Keys Hashes Table
(ECDSA is the authentication algorithm)
- EDMK : Encryption/Decryption Master Key

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fd1f4c9a 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: support several key in command stm32key

Update the command stm32key to support several keys selected by
key name and managed by the new sub-command:

stm32key list
stm32key select [<key>]
stm32key read -a

This patch doesn't change the STM32MP15 behavior, only PKH is
supported, but it is a preliminary patch for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 8921b3dc 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: introduced read_close_status function in stm32key command

Split the read_hash_otp function and introduce the helper function
read_close_status to read the close status in OTP separately of the PKH.

This patch is a preliminary step for STM32MP13 support.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# c6327ba4 15-Sep-2022 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: add defines for BSEC_LOCK status in stm32key command

Add defines for value used in stm32key for BSEC permanent lock status
and error.

This patch is a preliminary step to support more lock status in BSEC
driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 80cfc6c6 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add subcommand close

The expected sequence to close the device

1/ Load key in DDR with any supported load command
2/ Update OTP with key: STM32MP> stm32key read <addr>

At this point the device is able to perform image authentication but
non-authenticated images can still be used and executed.
So it is the last moment to test boot with signed binary and
check that the ROM code accepts them.

3/ Close the device: only signed binary will be accepted !!
STM32MP> stm32key close

Warning: Programming these OTP is an irreversible operation!
This may brick your system if the HASH of key is invalid

This command should be deactivated by default in real product.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# d3551b8e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add read OTP subcommand

Allow to read the OTP value and lock status with the command
$> stm32key read.

This patch also protects the stm32key fuse command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# e00e1f39 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: add get_misc_dev function

Add a helper function to access to BSEC misc driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 3da2552a 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: lock of PKH OTP after fuse

Lock the OTP value of key's hash after the command
$> stm32key fuse <address>

This operation forbids a second update of these OTP as they are
ECC protected in BSEC: any update of these OTP with a different value
causes a BSEC disturb error and the closed chip will be bricked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# fe24090e 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: handle error in fuse_hash_value

Handle errors in fuse_hash_value function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# bc78d5f2 28-Jun-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp: cmd_stm32key: use sub command

Simplify parsing the command argument by using
the macro U_BOOT_CMD_WITH_SUBCMDS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# eb653acd 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# f4cb5d69 05-Jul-2019 Patrick Delaunay <patrick.delaunay@st.com>

stm32mp1: key: add stm32key command

Add dedicated command to register in fuse a public hash
key provided by keygen tool.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>